package com.wsp.service.util;

import java.util.concurrent.*;

/**
 * Package: com.wsp.service.util
 * Description： TODO
 *
 * @Author: 巫思平
 * Copyright: Copyright (c) 2020
 * Version: 1
 */
public class ScheduledExecutorServiceUtil {
    private static final ScheduledExecutorService service = new ScheduledThreadPoolExecutor(1,Executors.defaultThreadFactory(),new ThreadPoolExecutor.DiscardPolicy());
    public static void addTask(Runnable command, long initialDelay, long period) {
        service.scheduleAtFixedRate(command,initialDelay,period,TimeUnit.MILLISECONDS);
    }
}
